<template>
  <div class="login-page">
    <img src="@/assets/背景图.jpg" alt="背景图">
    <div class="form-container">
      <h2>欢迎登录初练小站</h2>
      <div class="form-item">
        <label for="nickname">昵称</label>
        <el-input v-model="nickname" placeholder="请输入昵称"></el-input>
      </div>
      <div class="form-item">
        <label for="password">密码</label>
        <el-input type="password" v-model="password" placeholder="请输入密码"></el-input>
      </div>
      <div class="form-item">
        <el-button @click="login">登录</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      nickname: '',
      password: ''
    };
  },
  methods: {
    login() {
      // 登录逻辑，可以根据实际需求进行处理
      // 可以通过 axios.post('/api/login', { nickname: this.nickname, password: this.password }) 发起登录请求
    }
  }
};
</script>

<style>
.login-page {
  position: relative;
  height: 100vh;
}

.login-page img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

.form-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  margin: 50px;
}

.form-item {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.form-item label {
  width: 100px;
  margin-right: 20px;
}

.form-item el-input {
  flex: 1;
}

.form-item el-button {
  margin-top: 20px;
}
</style>
